<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>一键生成代码</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/easy-generator/lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="/easy-generator/lib/font-awesome-4.7.0/css/font-awesome.min.css" media="all">
    <link rel="stylesheet" href="/easy-generator/css/public.css" media="all">
</head>
<body>
<pre id="code" class="layui-code">
//代码区域
var a = 'hello layui';
</pre>
<script src="/easy-generator/js/common/common.js" charset="utf-8"></script>
<script charset="utf-8">
    layui.define(["jquery", "code"], function (exports) {
        var $ = layui.$,
            layer = layui.layer;

        var path = getUrlParam('path')
        console.log(path);
        getAjax(basePath + "/api/file/file", {path: path}, function (result) {
            $('#code').html(result.msg);
            layui.code();
        });
    });


    //获取url中的参数
    function getUrlParam(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
        var r = window.location.search.substr(1).match(reg); //匹配目标参数
        if (r != null) return unescape(r[2]);
        return null; //返回参数值
    }
</script>
</body>
</html>